package com.group.zsxm.service;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.group.zsxm.service.common.BaseService;

@Service
public class XxglService extends BaseService{
	@SuppressWarnings("unchecked")
	public List<Map<String,String>> getIndexListByLx(String lmid){
		String sql = "select top 30 info_zg.xxid,xxbt,convert(char(10),info_zg.rq,20) as rq from info_zg,info_lmzg where info_zg.xxid=info_lmzg.xxid and info_zg.spbz='2' and info_lmzg.lmid="+lmid+"  order by info_zg.rq desc ";
		return this.getJdbcTemplate().queryForList(sql);
	}
	
	
	@SuppressWarnings("unchecked")
	public Map queryXxzg(String xxid){
		String sql = "select info_zg.xxid,info_zg.xxbt,info_zg.fbrid,dbo.GET_NAME(info_zg.fbrid) as fbrname,info_zg.fbxx,info_zg.spbz,convert(char(10),info_zg.rq,20) as rq,info_zg.sprq," +
		"info_zg.status,dbo.GET_ZGFJ(info_zg.XXID) AS fj " +
		"from info_zg where info_zg.xxid=? order by info_zg.xxid";
		return this.getJdbcTemplate().queryForMap(sql, new Object[]{xxid});
	}
	
	@SuppressWarnings("unchecked")
	public List<Map<String,String>> queryFj(String xxid){
		String sql = "select * from info_zgfj where xxid=?";
		return this.getJdbcTemplate().queryForList(sql, new Object[]{xxid});
	}
	
	@SuppressWarnings("unchecked")
	public String getFjName(String xxid,String fjid){
		return getSimpleJdbcTemplate().queryForObject("select fjmc from info_zgfj where xxid=? and fjxh=? ",String.class, new Object[]{xxid,fjid});
	}
	
	@SuppressWarnings("unchecked")
	public String getFjpath(String xxid,String fjid){
		return getSimpleJdbcTemplate().queryForObject("select fjpath from info_zgfj where xxid=? and fjxh=? ",String.class, new Object[]{xxid,fjid});
	}
}
